package util;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class PZUtil {
	private static String driver;
	private static String url;
	private static String user;
	private static String password;
	private static Connection con;
	static{
		Properties pro=new Properties();
		InputStream ins=Class.class.getResourceAsStream("/pz.properties");
		try {
			pro.load(ins);
			driver=pro.getProperty("driver");
			url=pro.getProperty("url");
			user=pro.getProperty("user");
			password=pro.getProperty("password");
			Class.forName(driver);
			con=DriverManager.getConnection(url, user, password);
			System.out.println("配置成功");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static Connection getConnection(){
		return con;
	}
}
